module PostsHelper
	def cut(post)
		inside = Hpricot(post.content_html).at('//inside')
		if inside
			title = inside.attributes["value"]
			title ||= "читать далее -->"
			html = post.content_html.gsub(/<inside[^>]*>((\n|.)*?)<\/inside>/, "<a href=\"#{user_post_url(post.user, post)}\">#{title}</a>")
			return html
		end
		post.content_html
	end
end
